package me.jayramafisher.mcsurvival;

import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChatEvent;

//File: PlayerEventHandler.java
//Description: recieves all non-block related events
//Last date of modification (yyyymmdd): 20110716

/**
*The PlayerEventHandler class is instantiated and registered by SurvivalPlugin. It handles all non-block related events.
*/

public class PlayerEventHandler extends PlayerListener
{

    public SurvivalPlugin plugin;

    public PlayerEventHandler(SurvivalPlugin instance)
    {
         plugin = instance;
    }

    public void onPlayerLogin(PlayerLoginEvent event)
    {
        //
    }

    public void onPlayerRespawn(PlayerRespawnEvent event)
    {
        if(event.getPlayer().getLastDamageCause().equals(org.bukkit.event.entity.EntityDamageEvent.DamageCause.FALL))
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " took a long walk over a short plank.");
        }
        else if(event.getPlayer().getLastDamageCause().equals(org.bukkit.event.entity.EntityDamageEvent.DamageCause.FIRE))
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " forgot to drop and roll.");
        }
        else if(event.getPlayer().getLastDamageCause().equals(org.bukkit.event.entity.EntityDamageEvent.DamageCause.DROWNING))
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " is swimming with the fishes.");
        }
        else if(event.getPlayer().getLastDamageCause().equals(org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT))
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " wussed out in a fight.");
        }
        else if(event.getPlayer().getLastDamageCause().equals(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION))
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " danced with a creeper");
        }
        else
        {
            event.getPlayer().chat(event.getPlayer().getDisplayName() + " died of unknown cause.");
        }
    }

    public void onPlayerInteract(PlayerInteractEvent event)
    {
        //
    }

    public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
    {
        //
    }

    public void onPlayerBucketFill(PlayerBucketFillEvent event)
    {
        //
    }

}
